﻿Option Strict On
Public Class LstViewItem
    Inherits ListViewItem

    Public Property SaveDir As String
        Get
            Return m_SaveDir
        End Get
        Set(value As String)
            m_SaveDir = value
            Dim strDir As System.IO.DirectoryInfo = New System.IO.DirectoryInfo(value)

            Dim StrName As String = strDir.ToString.Split(CChar("\"))(CType(strDir.ToString.Split(CChar("\")), ICollection).Count - 1).Replace(".sims3", "")
            Me.Text = Localize.Localize("Save Name: ") & StrName & vbNewLine
        End Set
    End Property

    Public ReadOnly Property Location As String
        Get
            Dim Name As String = ""
            For Each strData As String In IO.Directory.GetFiles(SaveDir, "*.dat", IO.SearchOption.AllDirectories)
                Dim fileContents As String
                fileContents = My.Computer.FileSystem.ReadAllText(strData)
                Name = fileContents.Split(CChar("_"))(0)
                Exit For
            Next
            Return Name
        End Get

    End Property

    Private Property m_SaveDir As String

    Public Property imgInstance As ULong

    Public Sub New(ByVal value As String, ByVal save As Save)
        m_SaveDir = value
        Dim strDir As System.IO.DirectoryInfo = New System.IO.DirectoryInfo(value)

        Dim StrName As String = strDir.ToString.Split(CChar("\"))(CType(strDir.ToString.Split(CChar("\")), ICollection).Count - 1).Replace(".sims3", "")
        Me.Text = Localize.Localize("Save Name: ") & StrName & vbNewLine & save.WorldName ' & vbNewLine
        Me.ImageKey = save.Hash
    End Sub


End Class
